TARGET ?= default_demo
objs   := start.o main.o

$(TARGET).bin:$(objs)
	arm-linux-gnueabihf-ld -Timx6ul.lds -o $(TARGET).elf $^
	arm-linux-gnueabihf-objcopy -O binary -S $(TARGET).elf $@
	arm-linux-gnueabihf-objdump -D -m arm $(TARGET).elf > $(TARGET).dis
	
%.o:%.s
	arm-linux-gnueabihf-gcc -Wall -nostdlib -c -O2 -o $@ $<
	
%.o:%.S
	arm-linux-gnueabihf-gcc -Wall -nostdlib -c -O2 -o $@ $<
	
%.o:%.c
	arm-linux-gnueabihf-gcc -Wall -nostdlib -c -O2 -o $@ $<

.PHONY: clean
clean:
	rm -rf *.o  *.imx $(TARGET).bin $(TARGET).elf $(TARGET).dis

